<template>
	<view>
		<shopItemVue v-for="item in data" :key="item.id" ref="serviceItem" v-if="data.length>0" :ids="id" :data="item">
		</shopItemVue>
		<uni-load-more :status="status"></uni-load-more>
	</view>
</template>

<script>
	import shopItemVue from '../../common/shopItem/shopItem.vue';
	export default {
		components: {
			shopItemVue
		},
		data() {
			return {
				id: "",
				total: 0,
				data: [],
				pageNo: 0,
				pageSize: 10
			}
		},
		mounted() {

		},
		onPullDownRefresh() {
			console.log("下拉刷新触发");
			this.total = 0
			uni.reLaunch({
				url: '/otherPage/personnelList/personnelList?id=' + this.id
			})
		},

		onReachBottom() {
			console.log("上拉触底触发");
			// if (10 < 2) {


			// 	this.status = "loading"
			// } else {
			// 	this.status = "noMore"
			// }
			if (this.pageNo * this.pageSize >= this.total) {
				this.status = "noMore"
				return;
			} else {
				this.status = "loading"
			}
			if (this.loading) return

			this.pageNo += 1
			console.log('我到地步了', this.pageNo)
			this.getservcieAndservice(this.id)

		},
		onLoad(options) {
			// 获取传递的参数

			// console.log('Received Array:', this.receivedArray);

			const {
				id
			} = options;
			if (id) {
				console.log('ID:', id); // 输出: 123
				this.getservcieAndservice(id)
				this.id = id
			} else {
				this.data = JSON.parse(decodeURIComponent(options.arrayData));
			}


		},
		methods: {
			getservcieAndservice(e) {
				const datas = {
					pageNo: this.pageNo,
					pageSize: this.pageSize,
					params: {
						id: e,
						serviceid: "",
						detailid: ""

					}
				}
				this.$http.post(`/serviceServicedetail/page`, datas).then(res => {
					console.log("信息", res.result.records);
					this.data = res.result.records
					this.total = res.result.total
				})
			},
		}
	}
</script>

<style lang="less">
	page {
		background-color: #e0ffff;
	}
</style>